#ifndef JLIB_GRAPHICS_MANAGERS_BUFFERMANAGER_H
#define JLIB_GRAPHICS_MANAGERS_BUFFERMANAGER_H

#include "../opengl/buffer_object.h"
#include "../../helper.h"
#include <unordered_map>

namespace jlib {


struct BufferManager : public Object {

  inline bool init () noexcept { return true; }

  BufferObject *get (const std::string &name) noexcept;

  BufferObject *get (const std::string &name, GLenum type, GLenum usage, GLsizei size) noexcept;

  void add (const std::string &name, BufferObject *buffer) noexcept;

  void clear () noexcept;

private:
  std::unordered_map<std::string, Objptr<BufferObject> > _cache;

}; // struct BufferManager


} // namespace jlib

#endif // JLIB_GRAPHICS_MANAGERS_BUFFERMANAGER_H
